{include file="common/head"/}
<div class="admin-main layui-anim layui-anim-upbit" ng-app="hd" ng-controller="ctrl">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>{$title}</legend>
    </fieldset>
    <form class="layui-form layui-form-pane">
        <div class="layui-form-item">
            <label class="layui-form-label">商品名称</label>
            <div class="layui-input-4">
                <input class="layui-input" value="{$info.name}" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">图片</label>
            <div class="layui-input-block">
            {foreach $info.pics as $key=>$vo}
                <img src="{$vo}" width="300">
            {/foreach}
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">品牌名称</label>
            <div class="layui-input-4">
                <input class="layui-input" value="{$info.brand_name}" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">货号</label>
            <div class="layui-input-4">
                <input class="layui-input" value="{$info.code}" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">价格</label>
            <div class="layui-input-4">
                <input class="layui-input" value="{$info.price}" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">发货时间</label>
            <div class="layui-input-4">
                <input class="layui-input" value="{$info.send_time}" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">适用人群</label>
            <div class="layui-input-4">
                <input class="layui-input" value="{$info.people_name}" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-4">
                <input class="layui-input" value="{$info.status_name}" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">审核时间</label>
            <div class="layui-input-4">
                <input class="layui-input" value="{$info.check_time}" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">发布时间</label>
            <div class="layui-input-4">
                <input class="layui-input" value="{$info.create_time}" disabled>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <a href="javascript:void(0)" class="layui-btn" id="check">审核</a>
                <a href="{:url('need')}" class="layui-btn layui-btn-primary">{:lang('back')}</a>
            </div>
        </div>
    </form>
</div>
{include file="common/foot"/}
<script src="/static/common/js/angular.min.js"></script>
<script>
    var m = angular.module('hd',[]);
    m.controller('ctrl',['$scope',function($scope) {
        $scope.field = '{$info|raw}'!='null'?{$info|raw}:{id:'', title:'', top:'', important:'', text:''};
        layui.use(['form', 'layer','layedit'], function () {
            var form = layui.form, $ = layui.jquery,layedit = layui.layedit;
            var id = {$info.id};
            $('#check').on('click', function () {
                layer.confirm('您确定执行审核操作吗？', function(index){
                    var loading = layer.load(1, {shade: [0.1, '#fff']});
                    $.post("{:url('needCheck')}",{id:id},function(res){
                        layer.close(loading);
                        if(res.code===1){
                            layer.msg(res.msg,{time:1000,icon:1},function () {
                                window.location.reload();
                            });

                        }else{
                            layer.msg('操作失败！',{time:1000,icon:2});
                        }
                    });
                    layer.close(index);
                });
            });

        });
    }]);
</script>